// package: rewords-server-2024
// filename: router
// author: diogoxiang@gmail.com
// time: 2024/7/19 下午3:59

package router

import (
	"context"

	"github.com/gogf/gf/v2/net/ghttp"

	"rewords-server-2024/internal/consts"
	"rewords-server-2024/internal/controller/admin"
	"rewords-server-2024/internal/controller/aiCtrl"
	"rewords-server-2024/internal/controller/bczCtrl"
	"rewords-server-2024/internal/controller/common"
	"rewords-server-2024/internal/controller/dingCtrl"
	"rewords-server-2024/internal/controller/wordCtrl"
	"rewords-server-2024/internal/service"
	"rewords-server-2024/utility/simple"
)

// Api 前台路由
func Api(ctx context.Context, group *ghttp.RouterGroup) {
	group.Group(simple.RouterPrefix(ctx, consts.AppApi), func(group *ghttp.RouterGroup) {

		// 限流 默认配置
		group.Middleware(service.Middleware().RateLimit())

		group.Bind(
			//hello.NewV1(),
			//base.NewCacheAPI(),
			//base.NewCommon(),
			//base.NewSystem(),
			//admin.Menu,
			//admin.OpenUser,
			admin.App,
			admin.Amis,
			dingCtrl.Ding,
			common.Upload,
			wordctrl.WordCtrl,
			wordctrl.BookCtrl,
			bczCtrl.BczWord,
		)
		//group.Bind(
		//	pay.Notify, // 支付异步通知
		//)

		// api 权限
		//group.Middleware(service.Middleware().ApiAuth)
		group.Bind(
			aiCtrl.AiCtrl,
		)
	})
}

func Static(ctx context.Context, group *ghttp.RouterGroup) {
	group.Group(simple.RouterPrefix(ctx, consts.AppStatic), func(group *ghttp.RouterGroup) {
		group.Middleware(service.Middleware().RateLimit())

		group.Bind(
			admin.AmisStatic,
			//admin.App,
		)

	})
}
